<?php
namespace app\we\controller;
use think\Controller;

class Crontab extends Controller{

    public function index($aid=''){
      $this->sendFeedInvitation();
     
    }

    //没三十分钟来一次，获取这三十分钟内扫码的顾客进行调研
    public function sendFeedInvitation(){
     
       $create_time = time()-3600*2;
       $map['create_time'] = array('EGT',$create_time);
       $customers = db('WeSceneScan')->field('openid,nickname')->where($map)->group('openid')->select();
       mylog(count($customers),date('Ymd H:i').'发送客情');
       if ($customers){
         foreach ($customers as $key => $customer) {
             $url='http://'.$_SERVER['HTTP_HOST'].url('we/feed/index2',['openid'=>$customer['openid']]);
             $info=$customer['nickname'].'/:love,饭吃饱了吗？如有哪些不满意滴或好建议，发给老板或老板娘，有奖励哦！说不定老板娘会给你一个吻……<a href="'.$url.'">猛击这里调戏老板娘</a>';
              echo $back=custom_message($customer['openid'],$info);
              mylog($customer['nickname'].$back,$customer['nickname'].$customer['openid']);
           }
       }
    }


}